package pers.dawnyang.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * 错误页面返回处理
 * 
 * @author dawn yang
 * @date 2021/04/20
 */
@Component
public class ErrorConfigurar implements ErrorPageRegistrar {

  @Override
  public void registerErrorPages(ErrorPageRegistry registry) {
    ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND, "/error/404");
    registry.addErrorPages(e404);
  }
}
